﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head lang="zh-cmn-Hans">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>内部登录</title>
    <link href="Login JS CSS/inc/aui.2.0.css" rel="stylesheet" />
    <link href="Login JS CSS/inc/public.css" rel="stylesheet" />
    <link href="Login JS CSS/inc/style.css" rel="stylesheet" />
   
</head>
<body>
    <!--头部-->
    <header class="aui-bar aui-bar-nav">
        <a class="aui-pull-left aui-btn">
            <span class="aui-iconfont"><img src="Login JS CSS/img/icon-headback－left.png"><span div class="head-txt">内部登录</span></span>
        </a>
        <a class="aui-pull-right aui-btn">
            <span class="aui-iconfont"><img src="Login JS CSS/img/icon-headmore-dian.png"></span>
        </a>
    </header>

    <div class="content">
        <div class="content-tilte"><center>登陆</center></div>
        <div class="lins"></div>
        <div class="form-box">

            <div class="input-form">
                <span><img src="Login JS CSS/img/icon-cellphone.png"></span>
                <input class="inputstyle" type="text" id="name" onblur="zh()" placeholder="账号">
                <span id="s1" style="color:#ff0000"></span>
            </div>
            <div class="lins"></div>
            <div class="input-form">
                <span><img src="Login JS CSS/img/icon－password.png"></span>
                <input class="inputstyle" type="password" id="pwd" onblur="mm()" placeholder="密码">
                <span id="s2" style="color:#ff0000"></span>
            </div>
            <div class="lins"></div>
            <div class="checkbox">
                <span><input name="rememberpassword" type="checkbox" value="" id="" />记住密码</span>
                <span class="aui-pull-right">忘记密码？</span>
            </div>
            <div class="lins"></div>
            <div class="sub">
                <input type="submit" name="submit" id="Login" onclick="Login()" value="登录">
            </div>


            <div class="or">
                <span class="division aui-pull-left"></span>
                <span class="txt-or">or</span>
                <span class="division aui-pull-right"></span>
            </div>
        </div>   
        </div>
        <script src="Scripts/jquery-1.8.2.min.js"></script>
        <script>
            //光标离开账户事件
            function zh() {
                var name = $("#name").val();
                if (name == "" || name == null) {
                    s1.innerHTML = "账号不能为空";
                    return;
                }
                else {
                    s1.innerHTML = "";
                } 
            }
            //离开密码事件
            function mm() {
                var pwd = $("#pwd").val();
                if (pwd == "" || pwd == null) {
                    s2.innerHTML = "密码不能为空";
                    return;
                }
                else {
                    s2.innerHTML = "";
                }
            }
            //用户登录事件
            function Login()
            {
                var name = $("#name").val();
                var pwd = $("#pwd").val();
                if (name == "" || pwd == "") {
                    alert("信息不完整！");
                    return;
                }
                else
                {
                    $.ajax({
                        url: "http://localhost:41607/api/Entrance/GetStaffLogin",
                        type: "Get",
                        data: {
                            name: name,
                            pwd:pwd
                        },
                        success: function (i)
                        {
                            if (i == 0) {
                                alert("该账号不存在");
                               
                            }
                            else if (i == 1) {
                                alert("密码错误");
                            
                            }
                            else if (i == 2)
                            {
                                alert("登陆成功");
                              
                            }
                        }
                    })
                }

            }
        </script>
</body>
</html>
